package com.metrology.app.util;import org.springframework.security.core.context.SecurityContextHolder;import com.metrology.app.domain.AdminUser;public class AdminUtil {	public static String getRealname() {		Object principal = SecurityContextHolder.getContext()				.getAuthentication().getPrincipal();		if (principal instanceof AdminUser) {			String realname = ((AdminUser) principal).getRealname();			return realname;		}		return "unknow";	}	public static String getUsername() {		Object principal = SecurityContextHolder.getContext()				.getAuthentication().getPrincipal();		if (principal instanceof AdminUser) {			String username = ((AdminUser) principal).getUsername();			return username;		}		return "unknow";	}		public static AdminUser getUser() {		Object principal = SecurityContextHolder.getContext()				.getAuthentication().getPrincipal();		if (principal instanceof AdminUser) {			AdminUser user = (AdminUser) principal;			return user;		}		return null;	}}